package org.yxt.springcloud.serivce;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.yxt.springcloud.entities.CommonResult;
import org.yxt.springcloud.serivce.impl.PaymentHystrixFallbackService;

/**
 * 调用订单支付Hystix的服务 并且使用OpenFeign调用
 *
 * @author Yang douya
 * @date 2020=2-01-03
 */
@Component
@FeignClient(value = "CLOUD-PROVIDER-HYSTRIX-PAYMENT8001", fallback = PaymentHystrixFallbackService.class)
public interface PaymentHystrixService {

    /**
     * 无耗时操作
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/hystrix/ok/{id}")
    CommonResult ok(@PathVariable(value = "id") int id);


    /**
     * 服务会停留3秒表示业务耗时
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/hystrix/fail/{id}")
    CommonResult fail(@PathVariable(value = "id") int id);
}
